package com.gjx.springboot.app.service.impl;

import com.gjx.springboot.app.service.DepartMentsService;
import com.gjx.springboot.infra.mapper.DepartMentsMapper;
import com.gjx.springboot.domain.entity.Departments;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service

public class DepartMentsServiceImpl implements DepartMentsService {
    @Autowired
    DepartMentsMapper departMentsMapper;
    @Override
    public List<Departments> getAllDepartMents() {
        List<Departments> allDepartMents = departMentsMapper.getAllDepartMents();
        return allDepartMents;
    }

    @Override
    public Boolean insertOneDepartMent(Departments departments) {
        Boolean aBoolean = departMentsMapper.insertOneDepartMent(departments);
        return aBoolean;
    }

    @Override
    public Boolean deleteOneDepartMent(Integer departmentId) {
        Boolean aBoolean = departMentsMapper.deleteByDepartmentId(departmentId);
        return aBoolean;
    }

    @Override
    public Boolean updateOneDepartMent(Departments departments) {
        Boolean aBoolean = departMentsMapper.updateDepartmentId(departments);
        return aBoolean;
    }
}
